﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ERP_CargoLeadManage.aspx.cs" Inherits="CRM_Manager_ERP_CargoLeadManage" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>客户商品目录</title>
    <link href="../css/PageStyle.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../JavaScript/Common.js"></script>
     <script type="text/javascript">
        function SelectedCargo() {
            var record = gridPanel_listdata.selModel.getSelected();
            Ext.getCmp('SelectedCargoId').setValue(record.data.CargoId);
            GridPanel2.reload();
        }
        function GetStateName(value) {
            switch (value) {
                case 0:
                    return "无效";
                case 1:
                    return "有效";
                default:
                    return "无效";
            }
        }
        function GetCargoState(a, b, c) {
            if (c.data.State == -1)
                return "无效";
            if (c.data.State == 1)
                return "有效";
            else
                return "无效";
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" AjaxViewStateMode="Enabled" />
    <ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
        <Content>
            <ext:Panel runat="server" Border="false" Layout="RowLayout">
                <TopBar>
                    <ext:Toolbar runat="server">
                        <Items>
                            <ext:Button ID="extBtn_Refresh" runat="server" Text="刷新" Icon="ArrowRefresh">
                                <Listeners>
                                    <Click Handler="gridPanel_listdata.reload();" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="extBtn_Add" runat="server" Text="新增" Icon="Add" />
                            <ext:Button ID="extBtn_Edit" runat="server" Text="修改" Icon="GroupEdit" />
                            <ext:Button ID="extBtn_Delete" runat="server" Text="删除" Icon="Delete">
                                <DirectEvents>
                                    <Click OnEvent="extBtn_Delete_Click">
                                    </Click>
                                </DirectEvents>
                            </ext:Button>
                            <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                             <ext:Button ID="extBtn_Export" runat="server" Text="导入客户Excel" Icon="PageWhitePut"></ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <Items>
                    <ext:FormPanel ID="searchForm" runat="server" Border="false" Padding="5" Height="117">
                        <Content>
                            <ext:FieldSet runat="server" Title="查询条件" Border="true" Layout="ColumnLayout" Header="true" Height="104">
                                <Items>
                                    <ext:Container runat="server" Layout="FormLayout" LabelAlign="Right" ColumnWidth="0.33">
                                        <Items>
                                            <ext:ComboBox runat="server" ID="extcomb_Custom" StyleSpec="width:70%" FieldLabel="客户名称" TabIndex="1"
                                            LabelStyle=" text-align:right; " Editable="false" ValueField="CustomerId" DisplayField="CustomerName" AnchorHorizontal="0.95" >
                                                <Store>
                                                    <ext:Store runat="server" ID="store_Custom" AutoLoad="true">
                                                        <Reader>
                                                            <ext:JsonReader IDProperty="CustomerId">
                                                                <Fields>
                                                                    <ext:RecordField Name="CustomerId" />
                                                                    <ext:RecordField Name="CustomerName" />
                                                                </Fields>
                                                            </ext:JsonReader>
                                                        </Reader>
                                                    </ext:Store>
                                                </Store>
                                            </ext:ComboBox>
                                            <ext:TextField runat="server" ID="exttxtf_Area" LabelStyle=" text-align:right; " FieldLabel="产地" AnchorHorizontal="0.95" ></ext:TextField>
                                            <ext:TextField runat="server" ID="exttxtf_CargoCode" LabelStyle=" text-align:right; " FieldLabel="商品代码" AnchorHorizontal="0.95" ></ext:TextField>
                                        </Items>
                                    </ext:Container>
                                    <ext:Container runat="server" Layout="FormLayout" LabelAlign="Right" ColumnWidth="0.33">
                                        <Items>
                                            <ext:TextField runat="server" ID="exttxtf_CargoName" LabelStyle=" text-align:right; " FieldLabel="商品名称" AnchorHorizontal="0.95" ></ext:TextField>
                                            <ext:TextField runat="server" ID="exttxtf_ByName" LabelStyle=" text-align:right; " FieldLabel="别名" AnchorHorizontal="0.95" ></ext:TextField>
                                            <ext:TextField runat="server" ID="exttxtf_ProduceName" LabelStyle=" text-align:right; " FieldLabel="生产厂家" AnchorHorizontal="0.95" ></ext:TextField>
                                        </Items>
                                    </ext:Container>
                                    <ext:Container ID="Container2" runat="server" Layout="FormLayout" LabelAlign="Right" ColumnWidth="0.33">
                                        <Items>
                                            <ext:TextField runat="server" ID="exttxtf_Spec" LabelStyle=" text-align:right; " FieldLabel="规格" AnchorHorizontal="0.95" ></ext:TextField>
                                            <ext:TextField runat="server" ID="exttxtf_Version" FieldLabel="型号" LabelStyle=" text-align:right; " AnchorHorizontal="0.95" ></ext:TextField>
                                            <ext:Panel ID="Panel2" runat="server" Height="25" AnchorHorizontal="0.95" Border="false" ButtonAlign="Right" >
                                                <Content>
                                                    <table width="100%">
                                                        <tr style="width: 100%">
                                                            <td align="right">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                            </td>
                                                            <td align="left" width="50%">
                                                                <ext:Button ID="extBtn_Search" runat="server" Text="查询" Icon="Find">
                                                                    <Listeners>
                                                                        <Click Handler="gridPanel_listdata.reload();" />
                                                                    </Listeners>
                                                                </ext:Button>
                                                            </td>
                                                            <td align="left" width="50%">
                                                                <ext:Button ID="extBtn_Clear" runat="server" Text="清空" Icon="BasketDelete">
                                                                    <Listeners>
                                                                        <Click Handler="searchForm.reset();" />
                                                                    </Listeners>
                                                                </ext:Button>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </Content>
                                            </ext:Panel>
                                        </Items>
                                    </ext:Container>
                                </Items>
                            </ext:FieldSet>
                        </Content>
                    </ext:FormPanel>
                    <ext:Panel runat="server" Border="false" RowHeight="0.7" Layout="FitLayout">
                        <Content>
                            <ext:GridPanel runat="server" ID="gridPanel_listdata" BodyStyle="border-width:1 0 0 0;" AutoScroll="true" TrackMouseOver="true" StripeRows="true">
                                <ColumnModel>
                                    <Columns>
                                        <ext:RowNumbererColumn Header="序号" Width="35" />
                                        <ext:Column Header="CargoId" DataIndex="CargoId" Hidden="true">
                                        </ext:Column>
                                        <ext:Column Header="商品名称" DataIndex="CargoName" Width="100">
                                        </ext:Column>
                                        <ext:Column Header="商品别名" DataIndex="ByName" Width="100">
                                        </ext:Column>
                                        <ext:Column Header="商品码" DataIndex="CargoCode" Width="100">
                                        </ext:Column>
                                        <ext:Column Header="规格" DataIndex="Spec" Width="120">
                                        </ext:Column>
                                        <ext:Column Header="型号" DataIndex="Version" Width="120">
                                        </ext:Column>
                                        <ext:Column Header="生产厂家" DataIndex="ProduceName" Width="100">
                                        </ext:Column>
                                        <ext:Column Header="产地" DataIndex="Area">
                                        </ext:Column>
                                        <ext:Column Header="单位" DataIndex="Unit" Width="100">
                                        </ext:Column>
                                        <ext:Column Header="来源" DataIndex="IsImport" Width="100">
                                        </ext:Column>
                                        <ext:Column Header="用途" DataIndex="Type_Name" Width="100">
                                        </ext:Column>
                                        <ext:Column Header="分类" DataIndex="Use_Name" Width="100">
                                        </ext:Column>
                                        <ext:Column Header="状态" DataIndex="State" Width="80">
                                            <Renderer Fn="GetCargoState" />
                                        </ext:Column>
                                    </Columns>
                                </ColumnModel>
                                 <Listeners>
                                    <RowClick Fn="SelectedCargo" />
                                </Listeners>
                                <Store>
                                    <ext:Store runat="server" ID="Store_Cargo" AutoLoad="true" OnRefreshData="OnData_Refresh" RemoteSort="true">
                                        <Proxy>
                                            <ext:PageProxy>
                                            </ext:PageProxy>
                                        </Proxy>
                                        <Reader>
                                            <ext:JsonReader IDProperty="CargoId">
                                                <Fields>
                                                    <ext:RecordField Name="CargoId" />
                                                    <ext:RecordField Name="CustomId" />
                                                    <ext:RecordField Name="CustomerName"/>
                                                    <ext:RecordField Name="CargoName" />
                                                    <ext:RecordField Name="Spell" />
                                                    <ext:RecordField Name="ByName" />
                                                    <ext:RecordField Name="CargoCode" />
                                                    <ext:RecordField Name="Spec" />
                                                    <ext:RecordField Name="Version" />
                                                    <ext:RecordField Name="ProduceName" />
                                                    <ext:RecordField Name="TypeId" />
                                                    <ext:RecordField Name="UseId" />
                                                    <ext:RecordField Name="Area" />
                                                    <ext:RecordField Name="Unit" />
                                                    <ext:RecordField Name="IsImported" />
                                                    <ext:RecordField Name="Pic" />
                                                    <ext:RecordField Name="InUser" />
                                                    <ext:RecordField Name="InDate" />
                                                    <ext:RecordField Name="DelUser" />
                                                    <ext:RecordField Name="DelDate" />
                                                    <ext:RecordField Name="DelState" />
                                                    <ext:RecordField Name="Type_Name" />
                                                    <ext:RecordField Name="Use_Name" />
                                                    <ext:RecordField Name="Inuser_Name" />
                                                    <ext:RecordField Name="Deluser_Name" />
                                                    <ext:RecordField Name="IsImport" />
                                                    <ext:RecordField Name="State" />
                                                </Fields>
                                            </ext:JsonReader>
                                        </Reader>
                                    </ext:Store>
                                </Store>
                                <SelectionModel>
                                    <ext:RowSelectionModel runat="server" SingleSelect="true" />
                                </SelectionModel>
                                <BottomBar>
                                    <ext:PagingToolbar runat="server" ID="PagingToolbar1" PageSize="20" DisplayInfo="true"
                                        Height="25" DisplayMsg="显示{0} - {1},共{2}条" EmptyMsg="没有可显示的记录" StateID="Store1" />
                                </BottomBar>
                            </ext:GridPanel>
                        </Content>
                    </ext:Panel>
                    <ext:Panel runat="server" Border="false" RowHeight="0.3" Layout="FitLayout">
                        <Content>
                            <ext:GridPanel ID="GridPanel2" runat="server" AutoScroll="true" Border="false" >
                                <ColumnModel ID="ColumnModel2" runat="server">
                                    <Columns>
                                        <ext:RowNumbererColumn Header="序号" Width="35" />
                                        <ext:Column Header="DetailId" DataIndex="DetailId" Hidden="true">
                                        </ext:Column>
                                        <ext:Column Header="状态" DataIndex="State" Width="60">
                                            <Renderer Fn="GetStateName" />
                                        </ext:Column>
                                        <ext:Column Header="供应单价" DataIndex="Supplyprice" Width="80">
                                        </ext:Column>
                                        <ext:Column Header="录入人" DataIndex="InuserNAME" Width="60">
                                        </ext:Column>
                                        <ext:DateColumn Header="录入时间" DataIndex="InDate" Width="80" Format="Y-m-d H:i:s">
                                        </ext:DateColumn>
                                        <ext:Column Header="停用人" DataIndex="DELNAME" Width="100">
                                        </ext:Column>
                                        <ext:DateColumn Header="停用时间" DataIndex="DelState" Width="80" Format="Y-m-d H:i:s">
                                        </ext:DateColumn>
                                    </Columns>
                                </ColumnModel>
                                <Store>
                                    <ext:Store ID="Store_Detail" runat="server"  AutoLoad="true" OnRefreshData="CargoDetail_Refresh">
                                        <Proxy>
                                            <ext:PageProxy>
                                            </ext:PageProxy>
                                        </Proxy>
                                        <Reader>
                                            <ext:JsonReader IDProperty="DetailId">
                                                <Fields>
                                                    <ext:RecordField Name="DetailId" />
                                                    <ext:RecordField Name="CargoId" />
                                                    <ext:RecordField Name="SupplyId" />
                                                    <ext:RecordField Name="SupplyName" />
                                                    <ext:RecordField Name="Supplyprice" />
                                                    <ext:RecordField Name="State" />
                                                    <ext:RecordField Name="Remark"/>
                                                    <ext:RecordField Name="Inuser" />
                                                    <ext:RecordField Name="InuserNAME" />
                                                    <ext:RecordField Name="InDate" Type="Date"/>
                                                    <ext:RecordField Name="DelUser" />
                                                    <ext:RecordField Name="DELNAME" />
                                                    <ext:RecordField Name="DelDate" Type="Date"/>
                                                    <ext:RecordField Name="DelState" />
                                                </Fields>
                                            </ext:JsonReader>
                                        </Reader>
                                    </ext:Store>
                                </Store>
                                <SelectionModel>
                                    <ext:RowSelectionModel ID="RowSelectionModel2" runat="server">
                                    </ext:RowSelectionModel>
                                </SelectionModel>
                            </ext:GridPanel>
                        </Content>
                    </ext:Panel>
                </Items>
            </ext:Panel>
        </Content>
    </ext:Viewport>
    <ext:Hidden runat="server" ID="SelectedCargoId">
    </ext:Hidden>
    </form>
</body>
</html>
